<html>
<body>
	<head>
	<meta charset="utf-8">
	<script src="http://code.jquery.com/jquery-latest.js"></script>
	</head>
	<body>
	<div id="root">
	</div>
	<script>
var getJSON = function(url) {
  var promise = new Promise(function(resolve, reject){

    var client = new XMLHttpRequest();
    client.open("GET", url);
    client.onreadystatechange = handler;  // 请求状态发生改变时回调
    client.responseType = "json";
    client.setRequestHeader("Accept", "application/json");
    client.send();

    function handler() {
      if (this.readyState !== 4) {
        return;
      }
      if (this.status === 200) {
        resolve(this.response);
      } else {
        reject(new Error(this.statusText));
      }
    };
  });

  return promise;
};

getJSON("http://localhost/markdown/json/true.json").then((json) => {
  console.log(json);
  return json.data
}, (error) => {
  console.error('出错了', error);
}).then((data) => {
   $('#root').append(data.value)
});

	</script>
	</body>
</html>
